Use Rsge package to perfom paralle computing with SGE.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | library (Rsge) sub_func <- function (x, arg) x + arg main_func <- function (x, arg) sub_func (x, arg) index = 1:100 jobs = lapply (index, function (x) sge.submit (func=main_func, x=x, arg=arg, function .savelist= c ( 'sub_func' ))) status = lapply (jobs, sge.job.status) while ( any (status==1)) { Sys.sleep (4) status = lapply (jobs, sge.job.status) } results = lapply (jobs, sge.list.get.result) |
Hide Comments